package cn.quang.search.admin.mapper;

import cn.quang.search.admin.entity.po.SearchResultFetcherTableRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author:  Entity Generator
 * @since:  2024-02-28 11:03:04
 */
public interface SearchResultFetcherTableRelationMapper extends BaseMapper<SearchResultFetcherTableRelation> {

    @Select(
            " SELECT * FROM search_result_fetcher_table_relation WHERE logic_table_id = #{logicTableId} "
    )
    List<SearchResultFetcherTableRelation> selectByLogicTableId(@Param("logicTableId") long logicTableId);

    @Select(
            " <script> " +
            "     SELECT * FROM search_result_fetcher_table_relation " +
            "     <where> " +
            "       <if test='fetcherIds != null and fetcherIds.size() > 0'> " +
            "         <foreach collection='fetcherIds' item='item' open='AND fetcher_id IN (' close=')' separator=','> " +
            "           #{item} " +
            "         </foreach> " +
            "       </if> " +
            "     </where> " +
            " </script> "
    )
    List<SearchResultFetcherTableRelation> selectByFetcherIds(@Param("fetcherIds") List<Long> fetcherIds);

    @Select(
            " SELECT * FROM search_result_fetcher_table_relation WHERE fetcher_id = #{fetcherId} "
    )
    List<SearchResultFetcherTableRelation> selectByFetcherId(@Param("fetcherId") long fetcherId);
}
